<template>
  <div class="AsideMain">
    <el-row class="tac">
        <el-menu
            :default-active="$store.state.MenuItenIndex"
            class="el-menu"
            @open="handleOpen"
            @close="handleClose"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b">
          <el-menu-item index="1" @click="gotoPage('/homeView',$event.index)">
            <i class="el-icon-s-home"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <el-menu-item index="2" @click="gotoPage('/administrators',$event.index)">
            <i class="el-icon-s-custom" ></i>
            <span slot="title">管理员配置</span>
          </el-menu-item>
          <el-menu-item index="3" @click="gotoPage('/userstrators',$event.index)">
            <i class="el-icon-user-solid"></i>
            <span slot="title">用户管理</span>
          </el-menu-item>
          <el-menu-item index="4" @click="gotoPage('/management',$event.index)">
            <i class="el-icon-s-goods"></i>
            <span slot="title">商品管理</span>
          </el-menu-item>
          <el-menu-item index="5" @click="gotoPage('/shopping',$event.index)">
            <i class="el-icon-s-order"></i>
            <span slot="title">订单管理</span>
          </el-menu-item>
          <el-menu-item index="6" @click="gotoPage('/bannner',$event.index)">
            <i class="el-icon-picture"></i>
            <span slot="title">轮播图管理</span>
          </el-menu-item>
          <el-menu-item index="7" @click="gotoPage('/news',$event.index)">
            <i class="el-icon-s-promotion"></i>
            <span slot="title">新闻资讯</span>
          </el-menu-item>
        </el-menu>
    </el-row>
  </div>
</template>

<script>


export default {
  name: "index",
  data() {
    return {
      headPortrait: this.$store.state.MenuItenIndex
    }
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    gotoPage(pages,key){
      this.$store.state.MenuItenIndex=key
      console.log(this.$route)
      // if(this.$route.fullPath=='')
      this.$router.push(pages)
    }
  }
}
</script>

<style scoped lang="scss">
.AsideMain{
  height: 100%;
  .tac{
    height: 100%;
  }
  .el-menu{
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    .el-submenu .el-menu-item {
      height: 50px;
      line-height: 50px;
      padding: 0 45px;
      min-width: 100%;
    }
    .el-menu-item{
      width: 100% !important;
      display: flex;
      align-items: flex-start;
      align-items: center;
      user-select:none;
    }
  }
}
</style>